# Contributor: psykose <alice@ayaya.dev>
# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=wasi-libc
pkgver=0_git20220525
_gitrev=30094b6ed05f19cee102115215863d185f2db4f0
pkgrel=1
pkgdesc="WASI libc implementation for WebAssembly"
url="https://github.com/WebAssembly/wasi-libc"
arch="all"
options="!check" # no testsuite
# https://github.com/WebAssembly/wasi-libc/blob/main/LICENSE
#   wasi-libc			- Apache License v2.0 WITH LLVM Exceptions AND
#				  Apache License v2.0 AND MIT
#   dlmalloc/			- CC0
#   libc-bottom-half/cloudlibc/	- BSD-2-Clause
#   libc-top-half/musl/		- MIT
license="Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND CC0-1.0 AND BSD-2-Clause"
makedepends="clang llvm"
source="wasi-libc-$_gitrev.tar.gz::https://github.com/WebAssembly/wasi-libc/archive/$_gitrev.tar.gz
	no-double-build.patch
	"
builddir="$srcdir"/$pkgname-$_gitrev

build() {
	# https://bugzilla.mozilla.org/show_bug.cgi?id=1773200#c4
	make CC=clang BULK_MEMORY_SOURCES=
}

package() {
	make INSTALL_DIR="$pkgdir"/usr/share/wasi-sysroot install
}

sha512sums="
17492263fd5dca422f19e0ff8533e1f440e3b7516dc24ef0d16fdc44832cc63ec288c9e930f63b47fb71497144fed55cc313acc74339d067b8d4f5c7c683df0f  wasi-libc-30094b6ed05f19cee102115215863d185f2db4f0.tar.gz
8241854f3331e4e22756f4414afcd6cd766d48e2a1a38ad6c95903f84b6f6b718b1ed0eae2ef0fe78f2ab5c87352ffb44f1eca3ea03983173b80f72af5948651  no-double-build.patch
"
